# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=minidump-stackwalk
_projectname=rust-minidump
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.15.2
pkgrel=1
pkgdesc="Provides both machine-readable and human-readable digests of a minidump, with backtraces and symbolication (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://github.com/rust-minidump/rust-minidump/tree/main/minidump-stackwalk'
license=('spdx:MIT')
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-rust"
)
source=("${_realname}-${pkgver}.tar.gz::https://github.com/rust-minidump/rust-minidump/archive/v${pkgver}.tar.gz")
sha256sums=('e5105a0e76421c1b86722762c4e22d333bcc977dd743386d05e0168ce94f9964')

prepare() {
  cp -r "${_projectname}-${pkgver}" "build-${MSYSTEM}"
  cd "build-${MSYSTEM}/minidump-stackwalk"

  cargo fetch \
    --locked \
    --manifest-path "../Cargo.toml"
}

build() {
  cd "build-${MSYSTEM}/minidump-stackwalk"

  cargo build \
    --release \
    --frozen \
    --manifest-path "../Cargo.toml"
}

package() {
  cd "build-${MSYSTEM}/minidump-stackwalk"

  cargo install \
    --frozen \
    --offline \
    --no-track \
    --path . \
    --root "${pkgdir}${MINGW_PREFIX}"
}
